<%@ page import="com.conversationboard.model.*" %>
<%@ page import="com.conversationboard.view.*" %>
<%@ page import="com.conversationboard.config.*" %>
<%@ page import="com.conversationboard.site.*" %>

<%@ page import="java.security.Principal" %>
<%@ page import="com.conversationboard.controller.confirm.Confirm" %>

<%@page pageEncoding="UTF-8"%>
<%@page contentType="text/html;charset=UTF-8"%>

<% String userToBeMadeBoardAdmin = (String) request.getAttribute("userid"); %>

<%
    Principal principal = request.getUserPrincipal();
    String userName = null;
    
    if (principal!=null) {
    	userName = principal.getName();
    }
   
 	User user = User.get(userName);
 	
 	/* Only site admins allowed to create new board admins */
 	
 	if (!user.isSiteAdmin()) {
		return; 	
 	}
%>


<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
		<title>Create a new Board Admin</title>
		<link rel="stylesheet" type="text/css" href="<%=Configuration.getInstance().getRoot()%>/Stylesheets/<%=StyleSheets.getStyleSheetFileName(request.getCookies())%>"/>
	</head>

	<body>
	
		<%= MainMenu.display(request.getUserPrincipal()) %>

		<div class="headingblock">
			<h1>Create a new Board Admin</h1>
		</div>


		<div class="mainblock">
	
			<form class="formsection" action='<%=Configuration.getInstance().getRoot()%>/Admin/NewBoardAdminControllerServlet?action=board' method='post'>

				<p>Now click on the board you wish to make this user an administrator of:</p>
	
				<%= Confirm.getKey(request.getUserPrincipal().getName()) %>
			 	<input name="userid" value="<%= userToBeMadeBoardAdmin%>" type="hidden" />
				<%= SelectBoardDisplay.display(user) %>

				<br /><br />
			 	<input type="submit" value="Create Board Admin" />
			 	
			</form>
		</div>

		<!--<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>-->
		<!--<script type="text/javascript">_uacct = "UA-1148679-1";urchinTracker();</script>--> 

	</body>
	
</html>
